class Solution
{
public:
    int maximizeSum(vector<int> &nums, int k)
    {
        return k * (*max_element(nums.begin(), nums.end())) + k * (k - 1) / 2;
    }
};